﻿namespace IBTrader.Indicator.Average
{
    using IBTrader.Modules.Read;
    using IBTrader.Charts;

    class SMA : BasePrices
    {
        public SMA(Worker worker, double interval = 600f) : base(worker, (int)interval) { }
        public override void Add(object _, Line line)
        {
            Prices.Add(line.Price);
            if (Prices.Init)
                OnHit(line, CalcPrice());
        }
        protected virtual double CalcPrice()
        {
            return Prices.Average();
        }
    }
}